Skip to main content
Version: 1.0.7

Chat API

Chat service API Documentation kadal demo

Version: 1.0.7

Paths

/aiwb/chat/api/v1/healthz

  • Method: GET
  • Summary: Health
  • Description: Return Health Status. :return:
  • Operation ID: health_aiwb_chat_api_v1_healthz_get
  • Responses:
    • 200:
      • Description: Successful Response
      • Content-Type: application/json

List Chats

  • Endpoint: /aiwb/chat/api/v1/
  • Method: GET
  • Summary: List Chat
  • Description: Retrieve a list of chats along with details on any guard rails violations associated with each chat. Guard rails violations refer to policy or rule violations flagged or monitored within chat interactions.
  • Operation ID: List_Chat_aiwb_chat_api_v1__get

Request Payload:

TypeParameterDescriptionData Typeis_optional
Query Parameterchat_bot_idID associated with chat botstringmandatory
Query Parameterpage_noSpecifies the page number to retrieve (1-based index)intmandatory
Query Parameterpage_sizeSpecifies the number of items per pageintmandatory

Sample code

import requests
URL = "https://api.kadal.ai/aiwb/chat/api/v1/"

# sample python code
headers = { "Authorization ": "Bearer 1234567890" }

params={
"chat_bot_id":"string",
"page_no":1,
"page_size":10,
"order":"asc/desc",
"ext_user_id_ref":"string"
}

response = requests.get(URL, headers=headers,params=params)
print(response)

Example response -

{
"status_code": 200,
"data": [
{
"chat_bot_id": "12345ewdwe122",
"user_query": "Hello",
"created_by": 1,
"bot_response_id": 1,
"bot_response": "How Can I Assist you Today?"
}
],
"total_skill_count": 5
}

Responses:

Status CodeDescriptionContent-Type
200Resource Createdapplication/json
400Bad Requestapplication/json
404Resource Not Foundapplication/json
403Forbiddenapplication/json
500Internal Server Errorapplication/json
422Validation Errorapplication/json

Get Chat by Bot ID

  • Endpoint: /aiwb/chat/api/v1/{chat_bot_id}

  • Method: GET

  • Summary: Get Chat
  • Description: Retrieve a list of chats using a specific chat bot ID.
  • Operation ID: Get_Chat_aiwb_chat_api_v1__chat_bot_id__get

Request Payload:

TypeParameterDescriptionData Typeis_optional
parameterchat_bot_idIdentifier of the chat botstringmandatory
parameterqueryQuery for the chatstringmandatory

Sample code

import requests
URL = "https://api.kadal.ai/aiwb/chat/api/v1/{chat_bot_id}"

# sample python code
headers = { "Authorization ": "Bearer 1234567890" }

params={
"chat_bot_id":"string",
"query":"string",
"continue_last_chat":bool,
"ext_user_id_ref":"string"
}

response = requests.get(URL, headers=headers,params=params)
print(response)

Example response -

{
"status_code": 200,
"message_id": 1,
"message": "Hello"
}

Responses:

Status CodeDescriptionContent-Type
200Resource Createdapplication/json
204Not Foundapplication/json
400Bad Requestapplication/json
403Forbiddenapplication/json
404Resource Not Foundapplication/json
507Insufficient Tokenapplication/json
500Internal Server Errorapplication/json
422Validation Errorapplication/json

Clear Chat History by Bot ID

  • Endpoint: /aiwb/chat/api/v1/clearhistory/{chat_bot_id}

  • Method: POST

  • Summary: Clear Chat History
  • Description: Facilitates the removal of chat history associated with a specific user within the context of a chat bot. This action effectively archives or deletes conversations linked to the user's interactions with the designated chat bot.
  • Operation ID: clear_chat_history_aiwb_chat_api_v1_clearhistory__chat_bot_id__post

Request Payload:

TypeParameterDescriptionData Typeis_optional
parameterchat_bot_idIdentifier of the chat botstringmandatory

Sample code

import requests
URL = "https://api.kadal.ai/aiwb/chat/api/v1/clearhistory/{chat_bot_id}"
# sample python code
headers = { "Authorization ": "Bearer 1234567890" }

params={
"chat_bot_id":"string"
}

response = requests.post(URL, headers=headers,params=params)
print(response)

Example response -

{
"status_code": 200,
"message": "Deleted previous conversations."
}

Responses:

Status CodeDescriptionContent-Type
200Successapplication/json
400Connection Errorapplication/json
403Unauthorized Accessapplication/json
404Not Foundapplication/json
500Internal Server Errorapplication/json
422Validation Errorapplication/json

Post Chat by Bot ID

  • Endpoint: /aiwb/chat/api/v2/{chat_bot_id}

  • Method: POST

  • Summary: Post Chat
  • Description: Empowers users to build interactive chat experiences with features for managing conversation flow and generating AI-powered responses to user queries.
  • Operation ID: post_chat_aiwb_chat_api_v2__chat_bot_id__post

Request Payload:

TypeParameterDescriptionData Typeis_optional
parameterchat_bot_idIdentifier of the chat botstringmandatory

Sample code

import requests
URL = "https://api.kadal.ai/aiwb/chat/api/v2/{chat_bot_id}"
# sample python code
headers = { "Authorization ": "Bearer 1234567890" }

params={
"chat_bot_id":"string",
"continue_last_chat":bool,
"ext_user_id_ref":"string"
}

response = requests.post(URL, headers=headers,params=params)
print(response)

Example response -

{
"status_code": 200,
"message_id": 1,
"message": "Hello"
}

Responses:

Status CodeDescriptionContent-Type
200Resource Createdapplication/json
204Not Foundapplication/json
400Bad Requestapplication/json
403Forbiddenapplication/json
404Resource Not Foundapplication/json
507Insufficient Tokenapplication/json
500Internal Server Errorapplication/json
422Validation Errorapplication/json

Add Feedback API -

  • Endpoint: /aiwb/chat/api/v1/feedbacks/

  • Method: POST

  • Summary: Add Feedback
  • Description: Provides functionality to provide feedback on a bot response.
  • Operation ID: Add_Feedback_aiwb_chat_api_v1_feedbacks__post

Feedback Submission Payload:

TypeParameterDescriptionData Typeis_optional
Query Parameterbot_response_idThe ID of the bot response being rated.integermandatory
Query Parameteris_positiveIndicates whether the feedback is positive (true) or negative (false).booleanmandatory
Query Parameterrating_idThe identifier representing the rating given to the bot response.integermandatory
Query ParametercommentAdditional comments or feedback provided by the user.stringoptional

Sample code

import requests
URL = "https://api.kadal.ai/aiwb/chat/api/v1/feedbacks/"
# sample python code
headers = { "Authorization ": "Bearer 1234567890" }

params={
"ext_user_id_ref":"string"
}

response = requests.post(URL, headers=headers,params=params)
print(response)

Example response -

{
"id": 0,
"bot_response_id": 0,
"is_positive": true,
"rating_id": 0,
"comment": "string"
}

Responses:

Status CodeDescriptionContent-Type
200Successful Responseapplication/json
422Validation Errorapplication/json

Components

Schemas

BotResponseFeedbackResp

  • Type: object
  • Description: Represents feedback on a bot response.
  • Properties:
    • id:
      • Type: integer
    • bot_response_id:
      • Type: integer
    • is_positive:
      • Type: boolean
    • rating_id:
      • Type: integer
    • comment:
      • Type: string

ChatValidator

  • Type: object
  • Description: Represents a chat validator object.
  • Properties:
    • message:
      • Type: string
    • metadata:
      • Type: object

FeedbackRequest

  • Type: object
  • Description: Represents a request for feedback on a bot response.
  • Properties:
    • bot_response_id:
      • Type: integer
      • Description: The ID of the bot response
    • is_positive:
      • Type: boolean
      • Description: Indicates whether the response is positive (thumbs up) or negative (thumbs down)
    • rating_id:
      • Type: integer
      • Description: The ID of the rating associated with the feedback
    • comment:
      • Type: string

HTTPValidationError

  • Type: object
  • Description: Represents an HTTP validation error response.
  • Properties:
    • detail:
      • Type: array

Msg

  • Type: object
  • Description: Represents a message object.
  • Properties:
    • msg:
      • Type: string

Order

  • Type: string
  • Description: An enumeration representing order.

ResponseCommon

  • Type: object
  • Description: Represents a common response object.
  • Properties:
    • status_code:
      • Type: integer
    • message:
      • Type: string

ResponseList

  • Type: object
  • Description: Represents a list response object.
  • Properties:
    • status_code:
      • Type: integer
    • total_count:
      • Type: integer
    • data:
      • Type: array
    • message:
      • Type: string

ValidationError

  • Type: object
  • Description: Represents a validation error response.
  • Properties:
    • loc:
      • Type: array
    • msg:
      • Type: string
    • type:
      • Type: string